import { createApp } from 'vue'
// import './style.css'
import App from './App.vue'
import router, { setupDynamicRoutes } from "./router";
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn' // 注意这个路径
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 引入重置样式
import "./style/reset.scss";
// 导入公共样式
import "./style/index.scss";
// 一定要在main.ts中导入tailwind.css，防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
import "./style/tailwind.css";

import 'element-plus/dist/index.css'

const app = createApp(App);
app.use(ElementPlus, {
    locale: zhCn,
})
// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(createPinia())

// 先注册动态路由，再挂载应用
setupDynamicRoutes().then(() => {
    app.use(router).mount('#app');
});

